<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page pageEncoding="UTF-8" %>
<%@page contentType="text/html; charset=UTF-8" language="java"%>
<%@ taglib uri="http://struts.apache.org/tags-html"  prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-bean"  prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@page import="com.kcs.common.utils.commonUtils"%>
<%@page import="com.kcs.common.utils.PropsUtils"%>
<%@page import="com.kcs.common.utils.Constant"%>

<html>
<head>
<title>FX Margin - Search Rate</title>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type="text/javascript" src="jsp/script/jquery/plugin/fancybox/jquery.easing-1.3.pack.js"></script>
<script type="text/javascript" src="jsp/script/jquery/plugin/fancybox/jquery.fancybox-1.3.4.js"></script>
<script type="text/javascript" src="jsp/script/jquery/plugin/fancybox/jquery.fancybox-1.3.4.pack.js"></script>   
<script type="text/javascript" src="jsp/script/jsDatePick.full.1.3.js"></script>   	 	 	
<script type="text/javascript" src="jsp/script/common.js"></script>  
<link rel="stylesheet" type="text/css" href="jsp/script/jquery/plugin/fancybox/jquery.fancybox-1.3.4.css"/>
<link rel="stylesheet" type="text/css" href="jsp/css/table.css"/>
<link rel="stylesheet" type="text/css" href="jsp/css/fxmarginStyle.css"/>
<link rel="stylesheet" type="text/css" href="jsp/css/jsDatePick_ltr.css" />


<script type="text/javascript">
	window.onload = function(){
		new JsDatePick({
			useMode:2,
			target:"inAsOfDate",
			dateFormat:"%d/%m/%Y"});

	};

	function validateSearchImportRRAndMMList(){
		var inAsOfDate = document.getElementsByName("inAsOfDate")[0];

		if(inAsOfDate.value==""){
			alert(m_please_1_condition);
			return false;
		}

		return true;
	}

	function searchImportRRAndMMList(){
		var tranCode = document.getElementsByName("tranCode")[0];

		if(validateSearchImportRRAndMMList()){
			tranCode.value = "searchImportRRAndMMList";
			document.forms[0].submit();
		}
		
	}

	function resetForm(){
		var tranCode = document.getElementsByName("tranCode")[0];
		tranCode.value = "resetForm";

		document.forms[0].submit();
	}

	// for popup customer //
	function onPopup(id, src, width, height){
		g_datacustomer = null;
		jQuery("#" + id + "_iframe").html("");
		src = "http://" + window.location.host + "/FxMargin/" + src + ".do?pAction=init";
		var html = "<center><iframe src='" + src +"' height='" + height +"px' width='" + width + "px' id='myIframe'></iframe></center>";

		jQuery("#" + id + "_iframe").html(html);

		openPopup(id);
		
	}

	function select(data){
		g_datacustomer = data;
	}
	
	function onCustomer(){
		/*	global variable 'g_datacustomer' is use	*/
 		
 		if(g_datacustomer != null){
 			jQuery("#inCifNo").val(g_datacustomer.cifNo);
 			jQuery("#inACName").val(g_datacustomer.marginAccName);	
 			jQuery.fancybox.close();
 	 	}
		
	}
	
	function offCustomer(){
		jQuery.fancybox.close();
	}
	// for popup customer //

</script>

</head>
<body>
	<!-- HEADER MENU -->
	<%@ include	file="include/headerMenu.jsp"%> 

	<center>
		<div id="divImportRRAndMMAction" style="width:95%;">
			<html:form action="/ImportRRAndMMAction.do" style="margin:0px;">
				<input type="hidden" name="tranCode" value=""/>
				
				<table class="MarginHeader" width="100%">
					<tr>
						<td style="text-align: left;">
							Search Rate
						</td>
					</tr>
				</table>
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td>
							<center>
								<table class="MarginCriteria" width="100%">
									<tr>
										<td align="right">As of Date</td>
										<td align="left"><html:text styleId="inAsOfDate" property="inAsOfDate" maxlength="10"/></td>
									</tr>
									<tr>
										<td colspan="4">
											<center>
												<input type="button" class="button" value="Search Rate" onclick="searchImportRRAndMMList();"/>
												&nbsp;
												&nbsp;
												<input type="button" class="button" value="Reset" onclick="resetForm();"/>
											</center>
										</td>
									</tr>
								</table>
							</center>
						</td>
					</tr>
					<tr>
						<td>
							<br><br><br>
							<center>
								<%
									Object err = request.getAttribute(Constant.ERR_ATTR);
								
									if(err != null){
										%>
											<script type="text/javascript">
												alert("<%=err%>");
											</script>
										<%
										
									}else{
										%>
											<logic:present name="<%=Constant.SHOW_RESULT%>">
												<div class="MarginTable" >
													<display:table id="data" name="sessionScope.ImportRRAndMMActionForm.importRRAndMMList" requestURI="/ImportRRAndMMAction.do" pagesize="10" >
														<display:column property="rowNum" title="No" sortable="false" style="text-align:center;"/>
														<display:column property="time" title="Time"   sortable="false" style="text-align:center;"/>
														<display:column property="currency" title="Currency" sortable="false"/>			
														<display:column property="today" title="TODAY" sortable="false" style="text-align:right;"/>
														<display:column property="tom" title="TOM" sortable="false" style="text-align:right;"/>
														<display:column property="spot" title="SPOT" sortable="false" style="text-align:right;"/>
														<display:column property="_1w" title="1W" sortable="false" style="text-align:right;"/>
														<display:column property="_2w" title="2W" sortable="false" style="text-align:right;"/>
														<display:column property="_1m" title="1M" sortable="false" style="text-align:right;"/>
														<display:column property="_2m" title="2M" sortable="false" style="text-align:right;"/>
														<display:column property="_3m" title="3M" sortable="false" style="text-align:right;"/>
														<display:column property="_6m" title="6M" sortable="false" style="text-align:right;"/>
														<display:column property="_9m" title="9M" sortable="false" style="text-align:right;"/>
														<display:column property="_1y" title="1Y" sortable="false" style="text-align:right;"/>
														<display:column property="_2y" title="2Y" sortable="false" style="text-align:right;"/>
													</display:table>
												</div>
											</logic:present>
										<%
									}
								%>
		
							</center>
						</td>
					</tr>
				</table>	
				
				<div style="display:none">
			        <div id="popupCustomer" style="width:710px;height: 600px">
			        	<div id="popupCustomer_iframe"></div>
						<table width="100%">
							<tr>
								<td width="33%" align="center">
									<input type="button" value="Ok" class="button" onclick="onCustomer();"/>
								</td>
								<td width="34%" align="center">
									<input type="button" value="Close" class="button" onclick="offCustomer();"/>
								</td>
							</tr>
						</table>
			        </div>
			    </div>
			    
				<%@ include	file="include/footer.jsp"%> 
				<%@ include	file="include/message.jsp"%> 
			</html:form>
		</div>
	</center>
</body>
</html>